<?php

namespace App\Http\Controllers;

use App\Question;
use Illuminate\Http\Request;

class QuestionController extends Controller
{
    public function index()
    {
        $questions = Question::latest('created_at')->Paginate(8);
        return view('Master.questions',compact('questions'));
    }

    public function destroy($id)
    {
        Question::destroy($id);
        session()->flash('success', '删除成功');
        return redirect()->route('questions.index');
    }
}
